<?php

if(isset($_REQUEST['offset'])){
	$v_offset=$_REQUEST['offset'];
}
else
	$v_offset=1;
	
$v_limit = CONST_NUMBER_OF_QA_PER_PAGE;
//$v_limit =1;
if(isset($_REQUEST['page'])){
	$page=$_REQUEST['page'];
}
else
	$page=1;
/////////////////////////////////////////////////////////////////////////


$v_cate_id = 0;
if(isset($_REQUEST['cate_id'])){
	$v_cate_id = intval(trim($_REQUEST['cate_id']));
}

$v_searched_text_qa = '';
if(isset($_REQUEST['searched_text_qa'])){
	$v_searched_text_qa = $_REQUEST['searched_text_qa'];
}
$v_status = 2;

if(_is_sqlserver()){
	$cmd = @mssql_init("ONEGATE_QA_FTS_ALL_SEARCH", $conn);
	@mssql_bind($cmd, "@p_filter", $v_searched_text_qa, SQLVARCHAR);
	@mssql_bind($cmd, "@p_status", $v_status, SQLINT4);
	$result = @mssql_execute($cmd);
	$arr_result = _get_row_to_array($result); 
	@mssql_free_result($result);	
	$v_total_qa_count=sizeof($arr_result);

	$pager  = Pager::getPagerData($v_total_qa_count, $v_limit, $page);
	$page   = $pager->page;
  	$offset = $pager->offset +1; 
  	$limit = $pager->limit;
	
	$cmd = @mssql_init("ONEGATE_QA_FTS_SEARCH", $conn);
	@mssql_bind($cmd, "@p_filter", $v_searched_text_qa, SQLVARCHAR);
	@mssql_bind($cmd, "@p_status", $v_status, SQLINT4);
	@mssql_bind($cmd,"@offset", $offset,SQLINT4);	
	@mssql_bind($cmd,"@limit",$limit,SQLINT4);	
	$result = @mssql_execute($cmd);
	$arr_qa = _get_row_to_array($result);
	$v_num_qa=sizeof($arr_qa);	
	@mssql_free_result($result);
}
?>